﻿using Autodesk.Revit.DB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace demo
{
    public class GeometryCreation
    {
        public static readonly GeometryCreation Instance = new GeometryCreation();
        public enum CylinderDirection
        {
            BasisX,
            BasisY,
            BasisZ
        };
        /// <summary>
        /// 创建拉伸几何图形
        /// </summary>
        /// <param name="profileLoops">要拉伸的轮廓回路</param>
        /// <param name="extrusionDir">方向</param>
        /// <param name="extrusionDist">拉伸距离</param>
        /// <returns></returns>
        public Solid CreateExtrusion(List<CurveLoop> profileLoops, XYZ extrusionDir, double extrusionDist)
        {
            return GeometryCreationUtilities.CreateExtrusionGeometry(profileLoops, extrusionDir, extrusionDist);
        }
        /// <summary>
        /// 创建旋转几何图形
        /// </summary>
        /// <param name="coordinateFrame"></param>
        /// <param name="profileLoops"></param>
        /// <param name="startAngle"></param>
        /// <param name="endAngle"></param>
        /// <returns></returns>
        private Solid CreateRevolved(Autodesk.Revit.DB.Frame coordinateFrame, List<CurveLoop> profileLoops, double startAngle, double endAngle)
        {
            return GeometryCreationUtilities.CreateRevolvedGeometry(coordinateFrame, profileLoops, startAngle, endAngle);
        }
        /// <summary>
        /// 创建扫描几何图形
        /// </summary>
        /// <param name="sweepPath">扫描路径，由一组连续曲线组成</param>
        /// <param name="pathAttachmentCrvIdx">轮廓循环所在的扫描路径中的曲线索引</param>
        /// <param name="pathAttachmentParam">指定的路径曲线参数</param>
        /// <param name="profileLoops">定义沿路径扫描的平面域的曲线循环</param>
        /// <returns></returns>
        private Solid CreateSwept(CurveLoop sweepPath, int pathAttachmentCrvIdx, double pathAttachmentParam, List<CurveLoop> profileLoops)
        {
            return GeometryCreationUtilities.CreateSweptGeometry(sweepPath, pathAttachmentCrvIdx, pathAttachmentParam, profileLoops);
        }
        /// <summary>
        /// 创建混合几何体
        /// </summary>
        /// <param name="firstLoop">第一个曲线循环</param>
        /// <param name="secondLoop">第二个曲线循环</param>
        /// <param name="vertexPairs">该输入指定了两个外形回路的连接方式</param>
        /// <returns></returns>
        private Solid CreateBlend(CurveLoop firstLoop, CurveLoop secondLoop, List<VertexPair> vertexPairs)
        {
            return GeometryCreationUtilities.CreateBlendGeometry(firstLoop, secondLoop, vertexPairs);
        }
        /// <summary>
        /// 创建放样和过渡几何体
        /// </summary>
        /// <param name="pathCurve">扫描路径</param>
        /// <param name="pathParams">沿路径曲线增加的参数序列</param>
        /// <param name="profileLoops">沿路径排列的闭合平面曲线回路</param>
        /// <param name="vertexPairs">此输入指定应如何连接相邻的轮廓回路</param>
        /// <returns></returns>
        private Solid CreateSweptBlend(Curve pathCurve, List<double> pathParams, List<CurveLoop> profileLoops, List<ICollection<VertexPair>> vertexPairs)
        {
            return GeometryCreationUtilities.CreateSweptBlendGeometry(pathCurve, pathParams, profileLoops, vertexPairs);
        }


    }
}
